﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.VisualBasic;

public partial class Administrator_AdminControl_Nhanqua : System.Web.UI.UserControl
{
    security baomat = new security();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string title = txttitle.Text;
            int soluong = int.Parse(txtsoluong.Text);
            string mota = txtdescription.Text;
            int diem =int.Parse(txtpoint.Text);
            DateTime ngaybatdau =Convert.ToDateTime(dateStart.SelectedDate);
            DateTime ngaykethuc = Convert.ToDateTime(dateStop.SelectedDate);
            bool active = (chkActive.Checked) ? true : false;
            if (title != "" && txtsoluong.Text != "" && mota != "" && txtpoint.Text != "")
            {
                using (Up1VNDataContext dc = new Up1VNDataContext())
                {
                    GiftBackage gift = new GiftBackage();
                    gift.GiftBackage_Title = title;
                    gift.GiftBackage_WinnerAmount = (byte)soluong;
                    gift.GiftBackage_Description =baomat.FormatMultiline(mota);
                    gift.GiftBackage_FromDate = ngaybatdau;
                    gift.GiftBackage_ToDate = ngaykethuc;
                    gift.GiftBackage_Details = CKEditorControl1.Text;
                    gift.GiftBackage_Point = diem;
                }
            }
            else
                lblmsg.Text = "Nhập thông tin cần thiết.";
        }
        catch (Exception)
        {
        }
    }
    
}